package com.cxx.purchasecharge.core.model.persistence;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.cxx.purchasecharge.core.model.BaseModel;

/**
 * 资金流水记账
 * 
 * @author xiang
 * 
 */
@Entity
@Table (name = "pc_accounting")
public class Accounting extends BaseModel
{
    private static final long serialVersionUID = 1L;

    private long id;
    private float money;
    private AccountingType type;
    private Date created;
    private Date updated;
    private long payAccountId;
    private long projectId;
    private long userCreatedBy;
    private long userUpdatedBy;
    private String comment;
    
    public Accounting () {}

    @Id
    @GeneratedValue (strategy = GenerationType.AUTO)
    public long getId ()
    {
        return id;
    }

    public void setId (long id)
    {
        this.id = id;
    }

    @Column (nullable = false)
    public float getMoney ()
    {
        return money;
    }

    public void setMoney (float money)
    {
        this.money = money;
    }

    @ManyToOne
    @JoinColumn (name = "expense_type_id", nullable = false)
    public AccountingType getType ()
    {
        return type;
    }

    public void setType (AccountingType type)
    {
        this.type = type;
    }

    @Column (nullable = false)
    public Date getCreated ()
    {
        return created;
    }

    public void setCreated (Date created)
    {
        this.created = created;
    }

    public Date getUpdated ()
    {
        return updated;
    }

    public void setUpdated (Date updated)
    {
        this.updated = updated;
    }

    public long getPayAccountId()
    {
        return payAccountId;
    }

    public void setPayAccountId(long payAccountId)
    {
        this.payAccountId = payAccountId;
    }

    public long getProjectId ()
    {
        return projectId;
    }

    public void setProjectId (long projectId)
    {
        this.projectId = projectId;
    }

    @Column (nullable = false)
    public long getUserCreatedBy()
    {
        return userCreatedBy;
    }

    public void setUserCreatedBy(long userCreatedBy)
    {
        this.userCreatedBy = userCreatedBy;
    }

    @Column (nullable = false)
    public long getUserUpdatedBy()
    {
        return userUpdatedBy;
    }

    public void setUserUpdatedBy(long userUpdatedBy)
    {
        this.userUpdatedBy = userUpdatedBy;
    }

    @Column (length = 1024)
    public String getComment ()
    {
        return comment;
    }

    public void setComment (String comment)
    {
        this.comment = comment;
    }
}
